//
//  WodeTableViewController.m
//  IOSFM1
//
//  Created by lanou3g on 15/12/17.
//  Copyright © 2015年 朱梦扬. All rights reserved.
//

#import "WodeTableViewController.h"
#import "MYTableViewCell.h"
#import "heheTableViewCell.h"
static NSString * const reuseIdentifier = @"mycell";
static NSString * const reuseIdentifier1 = @"mycell1";


@interface WodeTableViewController ()
@property(nonatomic,strong)NSArray *array1;
@property(nonatomic,strong)NSArray *array2;
@property(nonatomic,strong)NSArray *arr1;
@property(nonatomic,strong)NSArray *arr2;
@property(nonatomic,strong)MYTableViewCell *MYTV;
@end

@implementation WodeTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupView];
    self.tableView.backgroundColor = [UIColor colorWithRed:0.8 green:1.1 blue:1.1 alpha:1.0];
    self.array1 = @[@"我的关注",@"我的上传",@"我的消息",@"找听友"];
    self.array2 = @[@"自动下载",@"定时关闭",@"车载收听",@"意见反馈"];
    self.MYTV = [[MYTableViewCell alloc] init];
    self.arr1 = @[@"8",@"9",@"10",@"11"];
    self.arr2 = @[@"12",@"13",@"14",@"15"];
    
    
}

-(void)setupView
{
 
    [self.tableView registerNib:[UINib nibWithNibName:@"MYTableViewCell" bundle:nil] forCellReuseIdentifier:reuseIdentifier1];
    UINib *nib1 = [UINib nibWithNibName:@"heheTableViewCell" bundle:[NSBundle mainBundle]];
    [self.tableView registerNib:nib1 forCellReuseIdentifier:reuseIdentifier];
    
    UIView *uv = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 250)];
    uv.backgroundColor = [UIColor colorWithRed:1.0 green:1.1 blue:1.1 alpha:1.0];
    
    self.tableView.tableHeaderView = uv;
    
    
    
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.backgroundColor = [UIColor redColor];
    button.frame = CGRectMake(182, 200, 60, 36);
    [self.tableView addSubview:button];
    [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    [button setTitle:@"登陆" forState:(UIControlStateNormal)];
    [button setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    UIImageView *myimage = [[UIImageView alloc] initWithFrame:CGRectMake(173, 108, 80, 80)];
    myimage.image = [UIImage imageNamed:@"1.png"];
    myimage.layer.cornerRadius = 80/2;
  
    [self.tableView addSubview:myimage];
    
    
    
}
-(void)buttonAction:(UIButton *)sender
{
  
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
//#warning Incomplete implementation, return the number of sections
 
    return 3;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if (section == 0) {
        return 1;
    }
    return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
        MYTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier forIndexPath:indexPath];
        

        return cell;
    }else if (indexPath.section == 1)
    
    {
        MYTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier1 forIndexPath:indexPath];
       
        cell.hehelabel.text = self.array1[indexPath.row];
        
        cell.myimage.image = [UIImage imageNamed:_arr1[indexPath.row]];
            
        

        return cell;
    }else if(indexPath.section  == 2){
    
        MYTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier1 forIndexPath:indexPath];
        
        cell.hehelabel.text = self.array2[indexPath.row];
        cell.myimage.image = [UIImage imageNamed:_arr2[indexPath.row]];
        return cell;
    }
    return nil;
}
// 距离头部的高度啊啊啊啊啊
-(CGFloat)tableView:(UITableView *)tableView estimatedHeightForHeaderInSection:(NSInteger)section
{
    return 10;
}





// section的距离
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.1;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
  
    if (indexPath.section == 0) {
        return 100;
    }else
        
        return 60;
}

@end
